package com.kaka.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UsersRoleMapper {

    @Delete("delete from users_role where users_role.roleId=#{rid}")
    int deleteByRid(int rid);

    int deleteByRids(@Param("ids") List<Integer> ids);

    @Update("update users_role set roleId=#{rid} where userId=#{uid}")
    int updateByRid(@Param("uid") int uid, @Param("rid") int rid);

    @Delete("delete from users_role where userId=#{id}")
    int deleteByUid(int id);

    @Insert("insert into users_role(userId,roleId) values(#{uid},#{rid})")
    int insertMessage(@Param("uid") int uid, @Param("rid") int rid);
}
